//
//  ViewController.m
//  ZPScrollView
//
//  Created by zkingsoft on 16/1/13.
//  Copyright (c) 2016年 zkingsoft. All rights reserved.
//

#import "ViewController.h"

#import "ZPCustomScrollView.h"

@interface ViewController ()

@property (nonatomic, strong) ZPCustomScrollView *myScrollView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    NSMutableArray *imageArray = [NSMutableArray array];
    
    for (int i = 0; i < 5; i++) {
        NSString *imgString = [NSString stringWithFormat:@"qsmy%d", i];
        
        UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:imgString]];
        
        [imageArray addObject:imageView];
    }
    
    // 使用 1 导入customScroll文件 并导入头文件
    //     2  创建一个iamgeView视图数组 作为数据源
    //     3  创建视图初始化和frame 设置数据源 和是否开启自动播放下一页
    //     4 block 执行点击事件
    
    _myScrollView = [[ZPCustomScrollView alloc] initWithFrame:CGRectMake(0, 100, [UIScreen mainScreen].bounds.size.width, 300)];
    [_myScrollView setImageViewArray:imageArray];
    [_myScrollView shouldAutoShowNextPage:YES];
    [self.view addSubview:_myScrollView];
    
    _myScrollView.TapActionBlock = ^(NSInteger pageIndex){
        NSLog(@"========%ld", pageIndex);
    };
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
